<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <title>查询</title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    <link rel="stylesheet" href="../lib/layui/css/layui.css" media="all">
    <style type="text/css">
        .redstar{
            color: red;
            margin-right: 5px;
        }
        .layui-field-title{
            color: #ffffff;
        }

    </style>
</head>
<body>
<div class="layuimini-container">
    <div class="layuimini-main">
        <table class="layui-table" id="columnChangeLog" lay-filter="columnChangeLog"></table>
    </div>
</div>


<script src="../lib/layui/layui.js" charset="utf-8"></script>
<script src="../js/jquery-1.9.0.js"></script>
<script type="text/javascript" src="../js/common.js"></script>

<script>
    layui.use(['form','element','table'],function () {
        var element = layui.element,
            form = layui.form,
            table = layui.table;

        /**
         * 获取初始数据
         */
        var id = getUrlParams('id');

        $(document).ready(function () {
            renderChangeLog(id);
        });

        /**
         * 渲染变更表
         */
        function renderChangeLog(id){
            var columnTable = table.render({
                elem: '#columnChangeLog',
                skin: 'row',
                method:'get',
                url:'/baseDataManagerServer/modelTableLog/listModelTableChangedLog',
                where:{
                    id:id
                },
                parseData:function (res){
                    return{
                        code:res.code,
                        data:res.data,
                        msg:res.msg,
                        count:res.count
                    }
                },
                cols: [
                    [{type: "checkbox", class: 'checkbox', width: 50},
                        {type: 'numbers', width: 50, title: '序号'},
                        {field: 'hierarchyName', width:200, title: '数据分层名称'},
                        {field: 'sourceConfigName',width:200,  title: '数据源名称'},
                        {field: 'tableName', width: 200, title:'表名'},
                        {field: 'columnCode',width: 100,title: '字段'},
                        {field: 'updateTime', width: 180, title: '更新时间'},
                        {field: 'updateField',width: 100,title: '变更信息',templet:function (d){
                                var str='';
                                if(d.updateField==='1'){
                                    str='更改字段描述';
                                }else if(d.updateField==='2'){
                                    str='更改字段';
                                }else if(d.updateField==='3'){
                                    str='更改类型';
                                }else if(d.updateField==='4'){
                                    str='更改小数';
                                }else if(d.updateField==='5'){
                                    str='更改长度';
                                }else if(d.updateField==='6'){
                                    str='更改默认值';
                                }else if(d.updateField==='7'){
                                    str='更改是否为空';
                                }else if(d.updateField==='8'){
                                    str='更改是否主键';
                                }
                                return str;
                            }},
                        {field: 'updateRemark',title: '描述'},
                    ]
                ],
                page:true,
                request:{
                    pageName:'page',
                    limitName:'pageSize'
                },
                done: function(res, curr, count) { // 表格渲染完成之后的回调
                    res.data.forEach(function(item, index) {
                        if (index % 2 === 0) {
                            $(".layui-table tbody tr[data-index='" + index + "']").css("background-color", "#FFFFFF");
                        } else {
                            $(".layui-table tbody tr[data-index='" + index + "']").css("background-color", "#F8F9FB");
                        }
                    });
                }
            });
        }


    });

        window.getUrlParams = function (key) {
        //获取url参数
        var reg = new RegExp("(^|&)" + key + "=([^&]*)(&|$)", "i");
        var url = decodeURI(window.location.search)
        var r = url.substr(1).match(reg);
        if (r != null) return unescape(r[2]);
        return null;
    }
</script>

</body>
</html>